/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package managedbean;

import javax.faces.bean.ManagedBean;
// Additional imports
import entity.GrouponEntity;
import entity.PurchasedGrouponEntity;
import entity.IssuedGrouponEntity;
import entity.StakeholderEntity;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.Serializable;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.ejb.EJB;
import javax.faces.application.FacesMessage;
import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;
import javax.faces.event.AbortProcessingException;
import javax.faces.event.ActionEvent;
import javax.faces.event.PhaseEvent;
import org.primefaces.event.FileUploadEvent;
import org.primefaces.event.SelectEvent;
import session.stateful.GrouponSessionBean;
import util.entityhelper.GrouponHelper;

/**
 *
 * @author NGUYEN CONG DAT
 */
@ManagedBean(name = "grouponManagerBean")
@SessionScoped
public class GrouponManagerBean implements Serializable {

    @EJB
    private GrouponSessionBean grouponSessionBean;
    private StakeholderEntity stakeholder;
    private GrouponEntity groupon;
    // These 4 lists are used for stakeholders
    private List<GrouponEntity> pendingGrouponApplicationList;
    private List<GrouponEntity> grouponApplicationList;
    private List<GrouponHelper> offeredGrouponList;
    private List<GrouponHelper> currentlyOfferedGrouponList;
    // These 4 lists are used for TCube
    private List<GrouponEntity> tCubePendingGrouponApplicationList;
    private List<GrouponHelper> tCubeCurrentlyOfferedGrouponList;
    private List<GrouponEntity> tCubeGrouponApplicationList;
    private List<GrouponHelper> tCubeOfferedGrouponList;
    // These 2 are used for both stakeholders and TCube
    private GrouponEntity selectedGrouponApplication;
    private GrouponHelper selectedGroupon;
    private boolean reloadPage = true;
    // Variables for purchase groupon information
    private List<PurchasedGrouponEntity> grouponPurchaseList;
    private boolean deactivateGrouponButton = false;
    private IssuedGrouponEntity selectedVoucher;
    private Boolean enableRedeemVoucher = false;
    private Boolean voucherExist = false;
    private String inputReferenceNumber = "";
    private FacesContext ctx = FacesContext.getCurrentInstance();

    /** Creates a new instance of GrouponManagerBean */
    public GrouponManagerBean() {
        grouponSessionBean = new GrouponSessionBean();
        stakeholder = (StakeholderEntity) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("stakeholder");
        groupon = new GrouponEntity();
        pendingGrouponApplicationList = new ArrayList<GrouponEntity>();
        grouponApplicationList = new ArrayList<GrouponEntity>();
        offeredGrouponList = new ArrayList<GrouponHelper>();
        currentlyOfferedGrouponList = new ArrayList<GrouponHelper>();
        tCubePendingGrouponApplicationList = new ArrayList<GrouponEntity>();
        tCubeGrouponApplicationList = new ArrayList<GrouponEntity>();
        tCubeCurrentlyOfferedGrouponList = new ArrayList<GrouponHelper>();
        tCubeOfferedGrouponList = new ArrayList<GrouponHelper>();
        selectedGrouponApplication = new GrouponEntity();
        selectedGroupon = new GrouponHelper(null, null);
        grouponPurchaseList = new ArrayList<PurchasedGrouponEntity>();
    }

    public void createGroupon(ActionEvent event) {
        try {
            System.out.println("Stakeholder ID : " + stakeholder.getId());
            getGrouponSessionBean().createGroupon(stakeholder.getId(), groupon);
            FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(
                    FacesMessage.SEVERITY_INFO, "Groupon application has been created and sent to TCube", ""));
            reloadPage = true;
        } catch (Exception e) {
            FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(
                    FacesMessage.SEVERITY_ERROR, "An error occurred ! Groupon application cannot be created", ""));
            e.printStackTrace();
        }
    }

    public void initTCubeViewGroupon(PhaseEvent event) throws IOException {
        if (selectedGroupon.getGroupon() == null) {
            String serverName = ctx.getExternalContext().getRequestServerName();
            int serverPort = (Integer) ctx.getExternalContext().getSessionMap().get("serverPort");
            String contextPath = ctx.getExternalContext().getRequestContextPath();
            ctx.getExternalContext().redirect("http://" + serverName + ":" + serverPort + contextPath + "/tourist/TCubeViewOfferedGroupons.xhtml");
        } else {
            if (selectedGroupon.getGroupon().getStatus().equalsIgnoreCase("Deal is on")) {
                deactivateGrouponButton = true;
            } else {
                deactivateGrouponButton = false;
            }
        }
    }

    public void voidGrouponApplication(ActionEvent event) {
        try {
            if (selectedGrouponApplication.getStatus().equals("Application Pending")) {
                getGrouponSessionBean().voidGrouponApplication(selectedGrouponApplication.getId());
                selectedGrouponApplication = new GrouponEntity();
                FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(
                        FacesMessage.SEVERITY_INFO, "Groupon application has been voided", ""));
            } else {
                FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(
                        FacesMessage.SEVERITY_ERROR, "This groupon application cannot be voided", ""));
            }
        } catch (Exception e) {
            FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(
                    FacesMessage.SEVERITY_ERROR, "An error occurred ! Groupon application cannot be voided", ""));
            e.printStackTrace();
        }
    }

    public String returnVoucherStatus(IssuedGrouponEntity voucher) {
        if (voucher == null) {
            return "Voucher is null !";
        } else {
            if (voucher.getDateOfUsage() != null) {
                return "Invalid : Voucher has been used";
            } else {
                if (timeIgnoringComparator(voucher.getDateOfUsage(), new Date()) < 0) {
                    return "Invalid : Voucher has expired";
                } else {
                    return "Valid : Voucher can be used";
                }
            }
        }
    }

    private int timeIgnoringComparator(Date d1, Date d2) {
        if (d1.getYear() != d2.getYear()) {
            return d1.getYear() - d2.getYear();
        }
        if (d1.getMonth() != d2.getMonth()) {
            return d1.getMonth() - d2.getMonth();
        }
        return d1.getDate() - d2.getDate();
    }

    public void visitorValidateVoucher(ActionEvent event) throws IOException {
        try {
            List<IssuedGrouponEntity> list = grouponSessionBean.getVoucherByReferenceNumber(getInputReferenceNumber());
            if (list.isEmpty()) {
                setVoucherExist((Boolean) false);
                setEnableRedeemVoucher((Boolean) false);
                FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(
                        FacesMessage.SEVERITY_ERROR, "Voucher does not exist", ""));
            } else {
                IssuedGrouponEntity voucher = list.get(0);
                setEnableRedeemVoucher((Boolean) true);
                setSelectedVoucher(voucher);
                setVoucherExist((Boolean) true);
                FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(
                        FacesMessage.SEVERITY_INFO, "Voucher exists", ""));
                String serverName = ctx.getExternalContext().getRequestServerName();
                int serverPort = (Integer) ctx.getExternalContext().getSessionMap().get("serverPort");
                String contextPath = ctx.getExternalContext().getRequestContextPath();
                ctx.getExternalContext().redirect("http://" + serverName + ":" + serverPort + contextPath + "/tourist/TCubeViewOfferedGroupons.xhtml");

            }
        } catch (Exception e) {
            FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(
                    FacesMessage.SEVERITY_ERROR, "An error occurred ! Voucher information cannot be retrieved ! Please try again later !", ""));
            e.printStackTrace();
        }
    }

    public void stakeholderValidateVoucher(ActionEvent event) throws IOException {
        try {
            List<IssuedGrouponEntity> list = grouponSessionBean.getVoucherByReferenceNumber(getInputReferenceNumber());
            if (list.isEmpty()) {
                setVoucherExist((Boolean) false);
                setEnableRedeemVoucher((Boolean) false);
                FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(
                        FacesMessage.SEVERITY_ERROR, "Voucher does not exist", ""));
            } else {
                IssuedGrouponEntity voucher = list.get(0);
                setEnableRedeemVoucher((Boolean) true);
                setSelectedVoucher(voucher);
                setVoucherExist((Boolean) true);
                FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(
                        FacesMessage.SEVERITY_INFO, "Voucher exists", ""));
                String serverName = ctx.getExternalContext().getRequestServerName();
                int serverPort = (Integer) ctx.getExternalContext().getSessionMap().get("serverPort");
                String contextPath = ctx.getExternalContext().getRequestContextPath();
                ctx.getExternalContext().redirect("http://" + serverName + ":" + serverPort + contextPath + "/stakeholder/StakeholderValidateGroupon.xhtml");

            }
        } catch (Exception e) {
            FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(
                    FacesMessage.SEVERITY_ERROR, "An error occurred ! Voucher information cannot be retrieved ! Please try again later !", ""));
            e.printStackTrace();
        }
    }

    public void declareVoucherAsUsed(ActionEvent event) throws IOException {
        try {
            grouponSessionBean.declareVoucherAsUsed(getSelectedVoucher().getId());
            setSelectedVoucher(null);
            setEnableRedeemVoucher((Boolean) false);
            FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(
                    FacesMessage.SEVERITY_INFO, "Voucher has been declared as Used", ""));
        } catch (Exception e) {
            FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(
                    FacesMessage.SEVERITY_ERROR, "An error occurred ! Voucher cannot be declared as Used ! Please try again later", ""));
        }
    }

    // Initialize list of GROUPON APPLICATIONS For STAKEHOLDERS
    public void initGrouponApplicationList(PhaseEvent event) throws IOException {
        pendingGrouponApplicationList = grouponSessionBean.getAllPendingGrouponApplicationsByStakeholderId(stakeholder.getId());
        grouponApplicationList = grouponSessionBean.getAllGrouponApplicationsByStakeholderId(stakeholder.getId());
        // offeredGrouponList = grouponSessionBean
    }

    // Initialize list of GROUPON APPLICATIONS For TCUBE
    public void initGrouponApplicationListForTCube(PhaseEvent event) throws IOException {
        tCubePendingGrouponApplicationList = grouponSessionBean.getAllPendingGrouponApplications();
        tCubeGrouponApplicationList = grouponSessionBean.getAllGrouponApplications();
        //tCubeOfferedGrouponList = new ArrayList<GrouponEntity>();
    }

    // Initialize list of GROUPONS For STAKEHOLDERS
    public void initGrouponList(PhaseEvent event) throws IOException {
        currentlyOfferedGrouponList = grouponSessionBean.getCurrentlyOfferedGrouponsByStakeholderId(stakeholder.getId());
        offeredGrouponList = grouponSessionBean.getOfferedGrouponsByStakeholderId(stakeholder.getId());
    }

    // Initialize list of GROUPONS For TCUBE
    public void initGrouponListForTCube(PhaseEvent event) throws IOException {
        tCubeCurrentlyOfferedGrouponList = grouponSessionBean.getAllCurrentlyOfferedGroupons();
        tCubeOfferedGrouponList = grouponSessionBean.getAllOfferedGroupons();
    }

    public void initViewGroupon(PhaseEvent event) throws IOException {
        if (!checkGroupon()) {
            return;
        }
    }

//    public void initTCubeViewGroupon(PhaseEvent event) throws IOException {
//        if (!tCubeCheckGroupon()) {
//            return;
//        }
//    }
    public void initViewGrouponApplication(PhaseEvent event) throws IOException {
        if (!checkGrouponApplication()) {
            return;
        }
    }

    public void initTCubeViewGrouponApplication(PhaseEvent event) throws IOException {
        selectedGrouponApplication = (GrouponEntity) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("selectedGrouponApplication");
        if (selectedGrouponApplication == null || selectedGrouponApplication.getId() == null) {
            String serverName = ctx.getExternalContext().getRequestServerName();
            int serverPort = (Integer) ctx.getExternalContext().getSessionMap().get("serverPort");
            String contextPath = ctx.getExternalContext().getRequestContextPath();
            ctx.getExternalContext().redirect("http://" + serverName + ":" + serverPort + contextPath + "/staff/TCubeViewAllGrouponApplications.xhtml");
        }
    }

    public void initAddGroupon(PhaseEvent event) throws IOException {
        if (reloadPage) {
            groupon = new GrouponEntity();
            reloadPage = false;
        }
    }
//    public boolean tCubeCheckGroupon() throws IOException {
//        selectedGroupon = (GrouponEntity) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("selectedGroupon");
//        if (selectedGroupon == null || selectedGroupon.getId() == null) {
//            FacesContext.getCurrentInstance().getExternalContext().redirect("TCube.xhtml");
//            return false;
//        }
//        return true;
//    }

    public boolean checkGroupon() throws IOException {
        if (!checkStakeholder()) {
            return false;
        }
        selectedGroupon = (GrouponHelper) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("selectedGroupon");
        if (selectedGroupon.getGroupon() == null || selectedGroupon.getGroupon().getId() == null) {
            String serverName = ctx.getExternalContext().getRequestServerName();
            int serverPort = (Integer) ctx.getExternalContext().getSessionMap().get("serverPort");
            String contextPath = ctx.getExternalContext().getRequestContextPath();
            ctx.getExternalContext().redirect("http://" + serverName + ":" + serverPort + contextPath + "/stakeholder/StakeholderViewOfferedGroupons.xhtml");
            return false;
        }
        return true;
    }

    public boolean checkGrouponApplication() throws IOException {
        if (!checkStakeholder()) {
            return false;
        }
        selectedGrouponApplication = (GrouponEntity) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("selectedGrouponApplication");
        if (selectedGrouponApplication == null || selectedGrouponApplication.getId() == null) {
            String serverName = ctx.getExternalContext().getRequestServerName();
            int serverPort = (Integer) ctx.getExternalContext().getSessionMap().get("serverPort");
            String contextPath = ctx.getExternalContext().getRequestContextPath();
            ctx.getExternalContext().redirect("http://" + serverName + ":" + serverPort + contextPath + "/stakeholder/StakeholderTrackGrouponApplications.xhtml");
            return false;
        }
        return true;
    }

    public boolean checkStakeholder() throws IOException {
        stakeholder = (StakeholderEntity) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("stakeholder");
        if (stakeholder == null || stakeholder.getId() == null) {
            stakeholder = new StakeholderEntity();
            String serverName = ctx.getExternalContext().getRequestServerName();
            int serverPort = (Integer) ctx.getExternalContext().getSessionMap().get("serverPort");
            String contextPath = ctx.getExternalContext().getRequestContextPath();
            ctx.getExternalContext().redirect("http://" + serverName + ":" + serverPort + contextPath + "/StakeholderLogin.xhtml");
        }
        return true;
    }

    public String onRowTCubeSelectNavigateGrouponApplication(SelectEvent event) {
        FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put("selectedGrouponApplication", selectedGrouponApplication);
        return "staff/TCubeViewGrouponApplication?faces-redirect=true";
    }

    public String onRowStakeholderSelectNavigateGrouponApplication(SelectEvent event) {
        FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put("selectedGrouponApplication", selectedGrouponApplication);
        return "stakeholder/StakeholderViewGrouponApplication?faces-redirect=true";
    }

    public String onRowTCubeSelectNavigateGroupon(SelectEvent event) {
        FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put("selectedGroupon", selectedGroupon);
        return "staff/TCubeViewGroupon?faces-redirect=true";
    }

    public String onRowStakeholderSelectNavigateGroupon(SelectEvent event) {
        FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put("selectedGroupon", selectedGroupon);
        return "stakeholder/StakeholderViewGroupon?faces-redirect=true";
    }

    public void acceptGrouponApplication(ActionEvent event) throws IOException {
//        if (!checkTableType()) {
//            return;
//        
        selectedGrouponApplication.setStatus("Application Successful");
        grouponSessionBean.editGroupon(selectedGrouponApplication);
        FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO, "Groupon has been successfully accepted", "You can go back to the groupon application listing to see the changes");
        FacesContext.getCurrentInstance().addMessage(null, message);
    }

    public void denyGrouponApplication(ActionEvent event) throws IOException {
//        if (!checkTableType()) {
//            return;
//        }
        selectedGrouponApplication.setStatus("Application Rejected");
        grouponSessionBean.editGroupon(selectedGrouponApplication);
        FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO, "Groupon application has been successfully Rejected", "You can go back to the groupon application listing to see the changes");
        FacesContext.getCurrentInstance().addMessage(null, message);
    }

    public void handleGrouponImageUpload(FileUploadEvent event) throws AbortProcessingException, NoSuchAlgorithmException {
        try {
            StakeholderEntity selectedStakeholder = (StakeholderEntity) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("stakeholder");
            System.out.println("Try to upload image");

            System.out.println(event.getFile().getFileName());
            String strDirectory = selectedStakeholder.getUsername();

            String filePath = "C:\\is3102Project\\IS3102Project-war\\web\\images\\upload\\media\\" + strDirectory + "\\groupons\\";

            File file = new File(filePath);
            if (!file.exists()) {
                if ((new File(filePath)).mkdirs()) {
                    System.out.println("Directory: " + strDirectory + " created");
                }
            }
            File result = new File(filePath + System.getProperty("file.separator") + event.getFile().getFileName().replace(" ", "_"));
            System.out.println("result: " + result + " created");
            FileOutputStream out = new FileOutputStream(result);
            int a;
            int BUFFER_SIZE = 8192;
            byte[] buffer = new byte[BUFFER_SIZE];
            InputStream is = event.getFile().getInputstream();
            while (true) {
                a = is.read(buffer);
                if (a < 0) {
                    break;
                }
                out.write(buffer, 0, a);
                out.flush();
            }
            groupon.setImageURL(strDirectory + "/groupons/" + event.getFile().getFileName().replace(" ", "_"));
            out.close();
            is.close();
            FacesMessage msg = new FacesMessage("Succesful " + event.getFile().getFileName() + " is uploaded.");
            FacesContext.getCurrentInstance().addMessage(null, msg);
        } catch (IOException e) {
            e.printStackTrace();
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }

    public void tCubeViewGrouponPurchaseInformation(ActionEvent event) throws IOException {
        grouponPurchaseList = grouponSessionBean.getPurchasedGrouponsByGrouponId(selectedGroupon.getGroupon().getId());
        FacesContext.getCurrentInstance().getExternalContext().redirect("staff/TCubeViewGrouponPurchases.xhtml");
    }

    public void stakeholderViewGrouponPurchaseInformation(ActionEvent event) throws IOException {
        grouponPurchaseList = grouponSessionBean.getPurchasedGrouponsByGrouponId(selectedGroupon.getGroupon().getId());
        FacesContext.getCurrentInstance().getExternalContext().redirect("stakeholder/StakeholderViewGrouponPurchases.xhtml");
    }

    public void deactivateGroupon(ActionEvent event) throws IOException {
        try {
            grouponSessionBean.deactivateGroupon(selectedGroupon.getGroupon().getId());
            FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO, "Groupon has been successfully deactivated", "Previous purchases have been refunded");
            FacesContext.getCurrentInstance().addMessage(null, message);
        } catch (Exception e) {
            e.printStackTrace();
            FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, "Error ! Groupon cannot be deactivated", "Try again later or contact the administrator for help");
            FacesContext.getCurrentInstance().addMessage(null, message);

        }
    }

    public int getQuantityBought() {
        return grouponSessionBean.getQuantityBought(selectedGroupon.getGroupon().getId());
    }

    /**
     * @return the grouponSessionBean
     */
    public GrouponSessionBean getGrouponSessionBean() {
        return grouponSessionBean;
    }

    /**
     * @param grouponSessionBean the grouponSessionBean to set
     */
    public void setGrouponSessionBean(GrouponSessionBean grouponSessionBean) {
        this.grouponSessionBean = grouponSessionBean;
    }

    /**
     * @return the stakeholder
     */
    public StakeholderEntity getStakeholder() {
        return stakeholder;
    }

    /**
     * @param stakeholder the stakeholder to set
     */
    public void setStakeholder(StakeholderEntity stakeholder) {
        this.stakeholder = stakeholder;
    }

    /**
     * @return the groupon
     */
    public GrouponEntity getGroupon() {
        return groupon;
    }

    /**
     * @param groupon the groupon to set
     */
    public void setGroupon(GrouponEntity groupon) {
        this.groupon = groupon;
    }

    /**
     * @return the pendingGrouponApplicationList
     */
    public List<GrouponEntity> getPendingGrouponApplicationList() {
        return pendingGrouponApplicationList;
    }

    /**
     * @return the grouponApplicationList
     */
    public List<GrouponEntity> getGrouponApplicationList() {
        return grouponApplicationList;
    }

    /**
     * @return the offeredGrouponList
     */
    public List<GrouponHelper> getOfferedGrouponList() {
        return offeredGrouponList;
    }

    /**
     * @return the selectedGroupon
     */
    public GrouponHelper getSelectedGroupon() {
        return selectedGroupon;
    }

    /**
     * @param selectedGroupon the selectedGroupon to set
     */
    public void setSelectedGroupon(GrouponHelper selectedGroupon) {
        this.selectedGroupon = selectedGroupon;
    }

    /**
     * @return the tCubePendingGrouponApplicationList
     */
    public List<GrouponEntity> gettCubePendingGrouponApplicationList() {
        return tCubePendingGrouponApplicationList;
    }

    /**
     * @return the tCubeGrouponApplicationList
     */
    public List<GrouponEntity> gettCubeGrouponApplicationList() {
        return tCubeGrouponApplicationList;
    }

    /**
     * @return the tCubeOfferedGrouponList
     */
    public List<GrouponHelper> gettCubeOfferedGrouponList() {
        return tCubeOfferedGrouponList;
    }

    /**
     * @return the selectedGrouponApplication
     */
    public GrouponEntity getSelectedGrouponApplication() {
        return selectedGrouponApplication;
    }

    /**
     * @param selectedGrouponApplication the selectedGrouponApplication to set
     */
    public void setSelectedGrouponApplication(GrouponEntity selectedGrouponApplication) {
        this.selectedGrouponApplication = selectedGrouponApplication;
    }

    /**
     * @return the currentlyOfferedGrouponList
     */
    public List<GrouponHelper> getCurrentlyOfferedGrouponList() {
        return currentlyOfferedGrouponList;
    }

    public List<PurchasedGrouponEntity> getGrouponPurchaseList() {
        return grouponPurchaseList;
    }

    public boolean isDeactivateGrouponButton() {
        return deactivateGrouponButton;
    }

    public IssuedGrouponEntity getSelectedVoucher() {
        return selectedVoucher;
    }

    public Boolean getEnableRedeemVoucher() {
        return enableRedeemVoucher;
    }

    public void setSelectedVoucher(IssuedGrouponEntity selectedVoucher) {
        this.selectedVoucher = selectedVoucher;
    }

    public void setEnableRedeemVoucher(Boolean enableRedeemVoucher) {
        this.enableRedeemVoucher = enableRedeemVoucher;
    }

    public Boolean getVoucherExist() {
        return voucherExist;
    }

    public void setVoucherExist(Boolean voucherExist) {
        this.voucherExist = voucherExist;
    }

    public String getInputReferenceNumber() {
        return inputReferenceNumber;
    }

    public void setInputReferenceNumber(String inputReferenceNumber) {
        this.inputReferenceNumber = inputReferenceNumber;
    }

    public List<GrouponHelper> gettCubeCurrentlyOfferedGrouponList() {
        return tCubeCurrentlyOfferedGrouponList;
    }
}
